// index.js
// 获取应用实例

const app = getApp()

Page({
  data: {
    lists:[
      {
        id:1,
        pic:"https://img.alicdn.com/imgextra/i3/O1CN01snYngu1diFSlYly1K_!!6000000003769-0-tps-476-538.jpg_640x640q75s0.jpg_.webp"
      },
      {
        id:2,
        pic:"https://img.alicdn.com/imgextra/i3/O1CN01y40vpx1Lo3OsL7rDm_!!6000000001345-0-tps-476-538.jpg_640x640q75s0.jpg_.webp"
      }
    ],
    books:[
      {
        id:1,
        pic:"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2F8a42830891abc1e1721cb95b3c52e7fa97b229211cfa-lQu7u5_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1629375394&t=0d66226152b7198a653d7ab7dc91b8f0",
        name:"学习笔记"
      },
      {
        id:2,
        pic:"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2F8a42830891abc1e1721cb95b3c52e7fa97b229211cfa-lQu7u5_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1629375394&t=0d66226152b7198a653d7ab7dc91b8f0",
        name:"读书笔记"
      }
    ],
    tops:[
      {
        id:1,
        pic:"https://img.alicdn.com/imgextra/i1/1691322032/O1CN01godGoN1QshSrGT3ef_!!0-item_pic.jpg_430x430q90.jpg"
      },
      {
        id:2,
        pic:"https://img.alicdn.com/imgextra/i1/1049653664/TB1FNXeLXXXXXcyXFXXXXXXXXXX_!!0-item_pic.jpg_430x430q90.jpg"
      }
    ]
  },
  // 事件处理函数
  bindViewTap() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  onLoad() {
    if (wx.getUserProfile) {
      this.setData({
        canIUseGetUserProfile: true
      })
    }
  },
  getUserProfile(e) {
    // 推荐使用wx.getUserProfile获取用户信息，开发者每次通过该接口获取用户个人信息均需用户确认，开发者妥善保管用户快速填写的头像昵称，避免重复弹窗
    wx.getUserProfile({
      desc: '展示用户信息', // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
      success: (res) => {
        console.log(res)
        this.setData({
          userInfo: res.userInfo,
          hasUserInfo: true
        })
      }
    })
  },
  getUserInfo(e) {
    // 不推荐使用getUserInfo获取用户信息，预计自2021年4月13日起，getUserInfo将不再弹出弹窗，并直接返回匿名的用户个人信息
    console.log(e)
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfo: true
    })
  }
})
